import request from "@/utils/request";
import type { SocBard, SocBardVO ,SocBardFollow} from "./type";
import type { PageType } from '@/api/type'


enum API {
    BARD_PAGE_URL = '/social/bard/page',
    BARD_VO_PAGE="social/bard/vo/page",
    BARD_URL = '/social/bard',
    BARD_BY_POST_URL="/social/bard/by/postId/",
    BARD_FOLLOW_URL="/social/bard/follow",
    BARD_FOLLOW='/social/bard/user/follow/list',
}

export function reqGetBardList(params: object) {
    return request<PageType<SocBard>>({
        url: API.BARD_PAGE_URL,
        method: 'get',
        params
    })
}
export function reqGetBardVOPage(params: object) {
    return request<PageType<SocBardVO>>({
        url: API.BARD_VO_PAGE,
        method: 'get',
        params
    })
}

export function reqGetBardById(bardId: string) {
    return request<SocBardVO>({
        url: API.BARD_URL + "/" + bardId,
        method: 'get',
    })
}
export function reqGetBardByPostId(postId: string) {
    return request<SocBardVO>({
        url: API.BARD_BY_POST_URL + postId,
        method: 'get',
    })
}

export function reqFollowBard(data: SocBardFollow) {
    return request({
        url: API.BARD_FOLLOW_URL,
        method: 'post',
        data
    })
}
export function reqDelFollowBard(bardId: string) {
    return request({
        url: API.BARD_FOLLOW_URL + "/" + bardId,
        method: 'delete',
    })
}
export function reqGetFollowBardList(userId: string|number) {
    return request<SocBardVO[]>({
        url: API.BARD_FOLLOW + "/" + userId,
        method: 'get',
    })
}
